package com.jzh.selfwallpaper.view.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.jzh.selfwallpaper.R;
import com.jzh.selfwallpaper.model.Model;
import com.jzh.selfwallpaper.util.PhoneUtil;

import imageloader.libin.com.images.loader.ImageLoader;

public class Model_2 extends RelativeLayout implements Model, View.OnClickListener {

    private MoveEditText mtv_model2_english, mtv_model2_name,
            mtv_model2_text1, mtv_model2_text2, mtv_model2_text3;
    private ImageView iv_model2_bg;
    private View viewMode2;
    private int base_blur = 0;
    private Context context;

    public Model_2(Context context) {
        super(context);
        this.context = context;
        init();
    }

    public Model_2(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.context = context;
        init();
    }

    private void init() {
        viewMode2 = LayoutInflater.from(context).inflate(R.layout.model_2, this, true);
        iv_model2_bg = viewMode2.findViewById(R.id.iv_model2_bg);
        iv_model2_bg.setOnClickListener(this);
        mtv_model2_english = viewMode2.findViewById(R.id.mtv_model2_english);
        mtv_model2_english.setText("Disappointing is also a kind of happiness");
        mtv_model2_name = viewMode2.findViewById(R.id.mtv_model2_name);
        mtv_model2_name.setText("[ Cherish ]");
        mtv_model2_text1 = viewMode2.findViewById(R.id.mtv_model2_text1);
        mtv_model2_text1.setText("因为有爱");
        mtv_model2_text2 = viewMode2.findViewById(R.id.mtv_model2_text2);
        mtv_model2_text2.setText("才会有期待");
        mtv_model2_text3 = viewMode2.findViewById(R.id.mtv_model2_text3);
        mtv_model2_text3.setText("所以纵使失望也是一种幸福");

        ImageLoader.with(context)
                .res(R.drawable.zrn2)
                .vignetteFilter()
                .into(iv_model2_bg);
    }

    @Override
    public void setPhoto(String path) {
        ImageLoader.with(context)
                .url(path)
                .vignetteFilter()
                .into(iv_model2_bg);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.iv_model2_bg:
                PhoneUtil.openAlbum(context);
                break;
        }
    }
}
